<template>
  <el-form>
    <el-form-item>
      <el-input v-model="userForm.username"  placeholder="名称"/>
    </el-form-item>
    <el-form-item>
      <el-input v-model="userForm.password" placeholder="密码" />
    </el-form-item>
    <el-form-item >
      <el-button style="width: 100%" type="primary" @click="toLogin">登录</el-button>
    </el-form-item>
  </el-form>
</template>

<script lang="ts" setup>
import { reactive} from 'vue'
import router from "../../../../router";
import {postUser} from "../../../../api/UserApi.ts";



const userForm = reactive({
  id: 0,
  username: 'eren',
  password: 'eren'
})

const toLogin = async () => {
  const res = await postUser(userForm)
  if (res.code === 200) {
    await router.push("/home/system/user/list")
  }
}
</script>
